1950B - Upscaling - CodeForces Solution


implementation

Please click on ads to support us..

Python Code:

def solve(n):
    matrix = [["." for _ in range(2 * n)] for _ in range(2 * n)]
    cnt = 0
    for i in range(len(matrix)):
        cnt += 1
        if cnt == 1 or cnt == 2:
            k = 0
        elif cnt == 3 or cnt == 4:
            k = 2
        elif cnt > 4:
            cnt = 1
            k = 0
        new_cnt = 0
        while k < len(matrix):
            new_cnt += 1
            if new_cnt == 1 or new_cnt == 2:
                matrix[i][k] = '#'
            elif new_cnt > 2:
                new_cnt = -1
            k += 1
    for row in matrix:
        for k in row:
            print(k, end = '')
        print()

def load_data():
    t = int(input())
    while t > 0:
        a = int(input())
        solve(a)
        t -= 1

load_data()


Comments

Submit
0 Comments
More Questions

1716C - Robot in a Hallway
1688B - Patchouli's Magical Talisman
99A - Help Far Away Kingdom
622B - The Time
1688C - Manipulating History
1169D - Good Triple
1675B - Make It Increasing
588A - Duff and Meat
1541B - Pleasant Pairs
1626B - Minor Reduction
1680A - Minimums and Maximums
1713A - Traveling Salesman Problem
1713B - Optimal Reduction
1710A - Color the Picture
1686B - Odd Subarrays
251A - Points on Line
427C - Checkposts
1159A - A pile of stones
508A - Pasha and Pixels
912A - Tricky Alchemy
1249A - Yet Another Dividing into Teams
1713C - Build Permutation
1699A - The Third Three Number Problem
1617B - GCD Problem
841A - Generous Kefa
1690B - Array Decrements
1692C - Where's the Bishop
104A - Blackjack
1438A - Specific Tastes of Andre
1711C - Color the Picture